#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#include <map>
using namespace std;
class Solution {
public:
    int jump(vector<int>& nums) {
        if (nums.size() <= 1)return 0;
        int maxi = 0;
        int dp[30000];
        dp[0] = 0;
        for (int i = 1; i < nums.size(); i++)dp[i] = 0x7fffffff;
        for (int i = 0; i < nums.size(); )
        {
            if (i + nums[i] >= nums.size() - 1)return dp[i] + 1;
            for (int j = 1; j <= nums[i]; j++)
            {
                dp[i + j] = dp[i] + 1;
                if (nums[maxi] + maxi < nums[i + j] + i + j)maxi = i + j;
            }
            i = maxi;
        }
        return dp[nums.size() - 1];
    }
};
int main()
{
    Solution s;
    
}